package com.example.dao;


import com.example.pojo.TrainingType;
import com.example.pojo.User;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface UserCrudRepository extends CrudRepository<User, Integer>, JpaSpecificationExecutor<User> {

    @Query(value = "SELECT * FROM user WHERE id_number = ?1 AND password = ?2", nativeQuery = true)
    User loginByIdNumber(String idNumber, String password);
    @Query(value = "SELECT * FROM user WHERE id = ?1 AND password = ?2", nativeQuery = true)
    User loginById(Integer id, String password);
    User getUserByPhone(String phone);

    User getUserByIdNumber(String idNumber);
    User getUserById(Integer id);

    List<User> getUserByRole(String role);
}
